<?php
/**
 * Html code of welcome page.
 * 
 * @package templates
 */
	$cm = CodeManager::getCodeManager(); 

if (!Policy::isAdminView()) { 
	require 'search.php';
?>
	<?php 
		SiteContext::getSiteContext()->getSiteInf()->templateCustom("mainPage", true);
	?>
	<div class="text"> <h2><?php echo $cm->get("30052"); ?></h2></div>
	<?php
		/*
		 * Get random top offers.
		 * SELECT column FROM table ORDER BY RAND() LIMIT 1
		 */
		HtmlOfferThumbnail::initWithFullQuery(Constants::DB_QUERY_OFFERS_ALL . " where offers.top = TRUE AND offers.status = 'visible' order by rand() limit 4", true, false, false, false, false);
	?>
	<div class="text"> <h2><?php echo $cm->get("30030"); ?></h2></div>
	<?php
		/*
		 * Get the latest offers.
		 */
		HtmlOfferList::initWithFullQuery("select offers.* from offers where offers.status = 'visible' order by creationTime desc limit 8", false, false, false, false);
		echo BR;
		HtmlOfferThumbnail::echoFooter(false, "javascript: Ajax.getIdsForSelectedOffersAndAddInBothViews(); ");
	?>
<?php } else { ?>
	<div class="text"><?php echo $cm->get("30067"); ?></div>
<?php } ?>